package com.ruoyi.project.kkad.adplace.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;

import java.util.Date;

/**
 * 广告位管理对象 advertising_place
 *
 * @author shixiangwen
 * @date 2020-04-13
 */
public class AdvertisingPlace extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;

    /**
     * 应用ID
     */
    @Excel(name = "应用ID")
    private String appId;

    /**
     * 编码
     */
    @Excel(name = "编码")
    private String code;

    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createdTime;

    /**
     * 创建用户
     */
    @Excel(name = "创建用户")
    private String createdUserId;

    /**
     * 广告类型
     */
    @Excel(name = "广告类型")
    private Long type;

    /**
     * 状态
     */
    @Excel(name = "状态")
    private Long status;

    /**
     * 宽
     */
    @Excel(name = "宽")
    private Long width;

    /**
     * 高
     */
    @Excel(name = "高")
    private Long height;

    /**
     *
     */
    @Excel(name = "")
    private Long openTird;

    /**
     * 开启第三方
     */
    @Excel(name = "开启第三方")
    private Long openThird;

    /**
     * 平台
     */
    @Excel(name = "平台")
    private String platform;

    /**
     * 第三方类型
     */
    @Excel(name = "第三方类型")
    private String thirdType;

    /**
     * 屏蔽策略
     */
    private int shieldStrategy;

    /**
     * 屏蔽后的三方类型
     */
    private String shieldThirdType;

    private String name;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppId() {
        return appId;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedUserId(String createdUserId) {
        this.createdUserId = createdUserId;
    }

    public String getCreatedUserId() {
        return createdUserId;
    }

    public void setType(Long type) {
        this.type = type;
    }

    public Long getType() {
        return type;
    }

    public void setStatus(Long status) {
        this.status = status;
    }

    public Long getStatus() {
        return status;
    }

    public void setWidth(Long width) {
        this.width = width;
    }

    public Long getWidth() {
        return width;
    }

    public void setHeight(Long height) {
        this.height = height;
    }

    public Long getHeight() {
        return height;
    }

    public void setOpenTird(Long openTird) {
        this.openTird = openTird;
    }

    public Long getOpenTird() {
        return openTird;
    }

    public void setOpenThird(Long openThird) {
        this.openThird = openThird;
    }

    public Long getOpenThird() {
        return openThird;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public String getPlatform() {
        return platform;
    }

    public void setThirdType(String thirdType) {
        this.thirdType = thirdType;
    }

    public String getThirdType() {
        return thirdType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getShieldStrategy() {
        return shieldStrategy;
    }

    public void setShieldStrategy(int shieldStrategy) {
        this.shieldStrategy = shieldStrategy;
    }

    public String getShieldThirdType() {
        return shieldThirdType;
    }

    public void setShieldThirdType(String shieldThirdType) {
        this.shieldThirdType = shieldThirdType;
    }

    public long getShowWidth() {
        int maxWidth = 400;
        if (this.width == null) {
            return 0;
        }
        if (this.height > this.width) {
            maxWidth = 150;
        }
        if (this.width > maxWidth) {
            return maxWidth;
        }
        return width;
    }

    public long getShowHeight() {
        if (this.width == null) {
            return 0;
        }
        int maxWidth = 400;
        if (this.height > this.width) {
            maxWidth = 150;
        }
        if (this.width > maxWidth) {
            return this.height * maxWidth / this.width;
        }
        return height;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("appId", getAppId()).append("code", getCode()).append("remark", getRemark())
                .append("createdTime", getCreatedTime()).append("createdUserId", getCreatedUserId()).append("type", getType()).append("status", getStatus()).append("width", getWidth())
                .append("height", getHeight()).append("openTird", getOpenTird()).append("openThird", getOpenThird()).append("platform", getPlatform()).append("thirdType", getThirdType()).toString();
    }
}
